package entity.lianxi.demo02;

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;

/*
* 通过反射获取构造方法*/
public class Maintest02 {
    public static void main(String[] args) throws Exception {
        try {
            Class<?> claa = Class.forName("entity.Student");
            Constructor<?> constructor = claa.getConstructor();
            Object obj = constructor.newInstance();
            Method method = claa.getMethod("show",String.class,int.class,float.class);
            method.invoke(obj,"强有名",18,180);

        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
